Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimization by class MonadThunk arguments order #859

Merged
merged 14 commits into from
Feb 25, 2021

Conversation

Anton-Latukha
Copy link
Collaborator

@Anton-Latukha Anton-Latukha commented Feb 23, 2021

Implementing the tail recursion for all class MonadThunk binary & ternary methods:

  • ✔️ force & forceThunk
  • ✔️ forceEff & forceThunkEff
  • ✔️ querryM & querryThunk
  • ✔️ further

The path towards #850.

Steps in next patch merges:

  • After that, the next step on the path is demand optimization.

Yesterday tried to go all the way - well, Functional Dependencies, of the class MonadThunk, is the pinnacle of the type system. And on factoring out the application from force - Functional Dependencies so far prevented the transference of types between HNix modus operandi.

So doing all possible improvement work up to it. After these optimizations, they also would be a clear picture & with more experienced people we would have the definite conclusion to the optimization & Functional Dependencies situation.

Tail recursion is already a big thing.

This is much more performant, sine gives tail recursion.

Also gives more straight-forward code implementation.

M  src/Nix/Cited/Basic.hs
M  src/Nix/Convert.hs
M  src/Nix/Lint.hs
M  src/Nix/Normal.hs
M  src/Nix/Standard.hs
M  src/Nix/Thunk.hs
M  src/Nix/Thunk/Basic.hs
M  src/Nix/Value.hs
M  src/Nix/Value/Equal.hs
`forces` are already flipped, which gives tail recursion.

This one gives more straight-forward implementation & use, maybe with some
performance optimization.

M  src/Nix/Cited/Basic.hs
M  src/Nix/Standard.hs
M  src/Nix/Thunk.hs
M  src/Nix/Thunk/Basic.hs
@Anton-Latukha Anton-Latukha force-pushed the 2021-02-22-thunk-force-optimization branch from 63f881c to f49fb00 Compare February 23, 2021 17:42
@Anton-Latukha Anton-Latukha force-pushed the 2021-02-22-thunk-force-optimization branch from f49fb00 to 46c9ab8 Compare February 23, 2021 19:06
They are not really used currently in the project.

This commit concludes the `class MonadThunk` arguments optimization work.

Next would be unflip of the `demand` and the moving-out of the stuff from the implementations.

ChangeLog: add note on the querry{M,Thunk} changes
@Anton-Latukha Anton-Latukha marked this pull request as ready for review February 25, 2021 14:20
@Anton-Latukha Anton-Latukha changed the title (WIP) MonadThunk optimization MonadThunk optimization Feb 25, 2021
@Anton-Latukha Anton-Latukha changed the title MonadThunk optimization optimization by class MonadThunk arguments order Feb 25, 2021
@Anton-Latukha Anton-Latukha merged commit b0253e8 into master Feb 25, 2021
@Anton-Latukha Anton-Latukha deleted the 2021-02-22-thunk-force-optimization branch February 25, 2021 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant